#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 2e5 + 5;

int n, m;
int a[N], d[N];
struct Bit {
  int n;
  vector<ll> bit;
  void init(int _n) {
    n = _n;
    bit = vector<ll>(n + 1, 0);
  }
  static int lowbit(int x) { return x & -x; }
  void add(int x, ll d) {
    for (int i = x; i <= n; i += lowbit(i)) bit[i] += d;
  }
  ll query(int x) {
    ll res = 0;
    for (int i = x; i > 0; i -= lowbit(i)) res += bit[i];
    return res;
  }
} bd, bkd;
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> m;
  rep(i, 1, n) cin >> a[i];
  rep(i, 1, n) d[i] = a[i] - a[i - 1];
  bd.init(n), bkd.init(n);
  rep(i, 1, n) bd.add(i, d[i]), bkd.add(i, 1ll * i * d[i]);
  while (m--) {
    char op;
    int l, r, x;
    cin >> op >> l >> r;
    if (op == 'Q') {
      ll x = (r + 1) * bd.query(r) - bkd.query(r);
      ll y = l * bd.query(l - 1) - bkd.query(l - 1);
      cout << x - y << endl;
    } else {
      cin >> x;
      bd.add(l, x), bd.add(r + 1, -x);
      bkd.add(l, 1ll * l * x), bkd.add(r + 1, -1ll * (r + 1) * x);
    }
  }
  return 0;
}